package com.spring.shops.dao;

import com.spring.shops.model.entity.TzSysMenu;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface TzSysMenuMapper {
    int deleteByPrimaryKey(Long menuId);

    int insert(TzSysMenu record);

    int insertSelective(TzSysMenu record);

    TzSysMenu selectByPrimaryKey(Long menuId);

    int updateByPrimaryKeySelective(TzSysMenu record);

    int updateByPrimaryKey(TzSysMenu record);
    //获取所有
    @Select("select * from tz_sys_menu")
    List<TzSysMenu> selectAll();

    @Select("select * from tz_sys_role_menu where role_id=#{roleId} and menu_id=#{menuId2}")
    TzSysMenu selectByMenuIdAndRoleId(Long roleId, Long menuId2);
    @Select("select * from tz_sys_menu where menu_id=#{menuId2}")
    TzSysMenu selectByParentId(Long menuId2);

    /**
     * 根据用户id查询当前用户所拥有的权限
     * @param currentId
     * @return
     */
    List<TzSysMenu> selectByUserId(Long currentId);

    /**
     * 获取当前用户的权限
     * @return
     */
    List<String> getPermsByUserId(Long userId);
}